package com.itheima.web;

import com.itheima.entity.Result;
import com.itheima.service.MemberService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: WangGuangHui
 * @date: 2020/11/23-10:41
 */
@RestController
@RequestMapping("/member")
public class MemberController {

    @Reference
    private MemberService memberService;

    @GetMapping("/selectMemberSexPercent")
    @PreAuthorize("hasAuthority('admin')")
    public Result selectMemberSexPercent(){
        return new Result(this.memberService.selectMemberSexPercent());
    }

    @GetMapping("/selectMemberNumLineChart/{startData}/{endData}")
    @PreAuthorize("hasAuthority('admin')")
    public Result selectMemberNumLineChart(@PathVariable("startData") String startData, @PathVariable("endData")String endData){
        return new Result(this.memberService.selectMemberNumLineChart(startData,endData));
    }
}
